home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / libogg / libvorbis-1.0rc3 / lib / backends.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-27  |  6.8 KB  |  193 lines

  1. /********************************************************************
  2.  *                                                                  *
  3.  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  4.  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
  5.  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  6.  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  7.  *                                                                  *
  8.  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
  9.  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
  10.  *                                                                  *
  11.  ********************************************************************
  12.  
  13.  function: libvorbis backend and mapping structures; needed for 
  14.            static mode headers
  15.  last mod: $Id: backends.h,v 1.12 2001/12/20 01:00:26 segher Exp $
  16.  
  17.  ********************************************************************/
  18.  
  19. /* this is exposed up here because we need it for static modes.
  20.    Lookups for each backend aren't exposed because there's no reason
  21.    to do so */
  22.  
  23. #ifndef _vorbis_backend_h_
  24. #define _vorbis_backend_h_
  25.  
  26. #include "codec_internal.h"
  27.  
  28. /* this would all be simpler/shorter with templates, but.... */
  29. /* Transform backend generic *************************************/
  30.  
  31. /* only mdct right now.  Flesh it out more if we ever transcend mdct
  32.    in the transform domain */
  33.  
  34. /* Time backend generic ******************************************/
  35. typedef struct{
  36.   void              (*pack)  (vorbis_info_time *,oggpack_buffer *);
  37.   vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
  38.   vorbis_look_time *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
  39.                   vorbis_info_time *);
  40.   vorbis_info_time *(*copy_info)(vorbis_info_time *);
  41.  
  42.   void (*free_info) (vorbis_info_time *);
  43.   void (*free_look) (vorbis_look_time *);
  44.   int  (*forward)   (struct vorbis_block *,vorbis_look_time *,
  45.              float *,float *);
  46.   int  (*inverse)   (struct vorbis_block *,vorbis_look_time *,
  47.              float *,float *);
  48. } vorbis_func_time;
  49.  
  50. typedef struct{
  51.   int dummy;
  52. } vorbis_info_time0;
  53.  
  54. /* Floor backend generic *****************************************/
  55. typedef struct{
  56.   void                   (*pack)  (vorbis_info_floor *,oggpack_buffer *);
  57.   vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
  58.   vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
  59.                    vorbis_info_floor *);
  60.   vorbis_info_floor     *(*copy_info)(vorbis_info_floor *);
  61.   void (*free_info) (vorbis_info_floor *);
  62.   void (*free_look) (vorbis_look_floor *);
  63.   int  (*forward)   (struct vorbis_block *,vorbis_look_floor *,
  64.              float *, const float *, /* in */
  65.              const float *, const float *, /* in */
  66.              float *);                     /* out */
  67.   void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
  68.   int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
  69.              void *buffer,float *);
  70. } vorbis_func_floor;
  71.  
  72. typedef struct{
  73.   int   order;
  74.   long  rate;
  75.   long  barkmap;
  76.  
  77.   int   ampbits;
  78.   int   ampdB;
  79.  
  80.   int   numbooks; /* <= 16 */
  81.   int   books[16];
  82.  
  83.   float lessthan;     /* encode-only config setting hacks for libvorbis */
  84.   float greaterthan;  /* encode-only config setting hacks for libvorbis */
  85.  
  86. } vorbis_info_floor0;
  87.  
  88. #define VIF_POSIT 63
  89. #define VIF_CLASS 16
  90. #define VIF_PARTS 31
  91. typedef struct{
  92.   int   partitions;                /* 0 to 31 */
  93.   int   partitionclass[VIF_PARTS]; /* 0 to 15 */
  94.  
  95.   int   class_dim[VIF_CLASS];        /* 1 to 8 */
  96.   int   class_subs[VIF_CLASS];       /* 0,1,2,3 (bits: 1<<n poss) */
  97.   int   class_book[VIF_CLASS];       /* subs ^ dim entries */
  98.   int   class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
  99.  
  100.  
  101.   int   mult;                      /* 1 2 3 or 4 */ 
  102.   int   postlist[VIF_POSIT+2];    /* first two implicit */ 
  103.  
  104.  
  105.   /* encode side analysis parameters */
  106.   float maxover;     
  107.   float maxunder;  
  108.   float maxerr;    
  109.  
  110.   int   twofitminsize;
  111.   int   twofitminused;
  112.   int   twofitweight;  
  113.   float twofitatten;
  114.   int   unusedminsize;
  115.   int   unusedmin_n;
  116.  
  117.   int   n;
  118.  
  119. } vorbis_info_floor1;
  120.  
  121. /* Residue backend generic *****************************************/
  122. typedef struct{
  123.   void                 (*pack)  (vorbis_info_residue *,oggpack_buffer *);
  124.   vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
  125.   vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
  126.                  vorbis_info_residue *);
  127.   vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
  128.   void (*free_info)    (vorbis_info_residue *);
  129.   void (*free_look)    (vorbis_look_residue *);
  130.   long **(*class)      (struct vorbis_block *,vorbis_look_residue *,
  131.             float **,int *,int);
  132.   int  (*forward)      (struct vorbis_block *,vorbis_look_residue *,
  133.             float **,float **,int *,int,int,long **,ogg_uint32_t *);
  134.   int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
  135.             float **,int *,int);
  136. } vorbis_func_residue;
  137.  
  138. typedef struct vorbis_info_residue0{
  139. /* block-partitioned VQ coded straight residue */
  140.   long  begin;
  141.   long  end;
  142.  
  143.   /* first stage (lossless partitioning) */
  144.   int    grouping;         /* group n vectors per partition */
  145.   int    partitions;       /* possible codebooks for a partition */
  146.   int    groupbook;        /* huffbook for partitioning */
  147.   int    secondstages[64]; /* expanded out to pointers in lookup */
  148.   int    booklist[256];    /* list of second stage books */
  149.  
  150.   /* encode-only heuristic settings */
  151.   float  entmax[64];       /* book entropy threshholds*/
  152.   float  ampmax[64];       /* book amp threshholds*/
  153.   int    subgrp[64];       /* book heuristic subgroup size */
  154.   int    blimit[64];       /* subgroup position limits */
  155. } vorbis_info_residue0;
  156.  
  157. /* Mapping backend generic *****************************************/
  158. typedef struct{
  159.   void                 (*pack)  (vorbis_info *,vorbis_info_mapping *,
  160.                  oggpack_buffer *);
  161.   vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
  162.   vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
  163.                  vorbis_info_mapping *);
  164.   vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
  165.   void (*free_info)    (vorbis_info_mapping *);
  166.   void (*free_look)    (vorbis_look_mapping *);
  167.   int  (*forward)      (struct vorbis_block *vb,vorbis_look_mapping *);
  168.   int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
  169. } vorbis_func_mapping;
  170.  
  171. typedef struct vorbis_info_mapping0{
  172.   int   submaps;  /* <= 16 */
  173.   int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
  174.   
  175.   int   timesubmap[16];    /* [mux] */
  176.   int   floorsubmap[16];   /* [mux] submap to floors */
  177.   int   residuesubmap[16]; /* [mux] submap to residue */
  178.  
  179.   int   psy[2]; /* by blocktype; impulse/padding for short,
  180.                    transition/normal for long */
  181.  
  182.   int   coupling_steps;
  183.   int   coupling_mag[256];
  184.   int   coupling_ang[256];
  185. } vorbis_info_mapping0;
  186.  
  187. #endif
  188.  
  189.  
  190.  
  191.  
  192.  
  193.